<template>
  <div class="hang">
    <span class="iconfont icon-fangdajing">搜索</span>
    <span @click="handclick(index)" v-for="(item,index) in list" :key="index" :class="{active:xiabiao==index}">{{item.text}}</span>
  </div>
</template>

<script>
export default {
data(){
    return{
        xiabiao:0,
        list:[
            {id:1,text:'点餐'},
            {id:2,text:'评价4.5'},
            {id:3,text:'商家'},
        ]

    }
    
},
methods:{
        handclick(index){
            this.xiabiao=index
        }
    }
}
</script>

<style scoped>
.hang{
    height: 60px;
    line-height: 60px;
    font-size: 22px;
    padding: 10px;
}
.hang span:nth-child(1){
    display: inline-block;
    width: 100px;
    height: 40px;
    border-radius: 40px;
    background-color: #eee;
    text-align: center;
    line-height: 40px;
}
.hang span{
    margin-right: 20px;
}
.hang span.active{
    display: inline-block;
    color: #138fe9;
    border-bottom: 2px solid #138fe9;
    height: 40px;
    line-height: 40px;
}
</style>